package com.gqz.defect.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gqz.common.core.domain.R;
import com.gqz.common.core.domain.RequestForm;
import com.gqz.defect.api.EnStockEquipDefectApi;
import com.gqz.defect.service.IEnStockEquipDefectService;
import com.gqz.defect.vo.AuditDefectsVo;
import com.gqz.defect.vo.EnDefectsTjVo;
import com.gqz.defect.vo.EnStockEquipDefectVo;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 能源-盘点任务设备缺陷表 Controller
 */
@RestController
@RequestMapping("/en-stock-equip-defect")
public class EnStockEquipDefectController implements EnStockEquipDefectApi {

    @Autowired
    private IEnStockEquipDefectService service;

    @Override
    public R<List<EnStockEquipDefectVo>> getById(String id) {
        return R.ok(service.getById(id));
    }

    @Override
    public R<Page<EnStockEquipDefectVo>> page(@Valid RequestForm<EnStockEquipDefectVo> requestForm) {
        return R.ok(service.page(requestForm));
    }

    @Override
    public R<Long> count(@Valid RequestForm<EnStockEquipDefectVo> requestForm) {
        return R.ok(service.count(requestForm));
    }

    @Override
    public R<Integer> insert(@Valid List<EnStockEquipDefectVo> vos) {
        return R.ok(service.insert(vos));
    }

    @Override
    public R<Integer> update(@Valid List<EnStockEquipDefectVo> vos) {
        return R.ok(service.update(vos));
    }

    @Override
    public R<Boolean> delete(@Valid List<String> ids) {
        return R.ok(service.removeBatchByIds(ids));
    }

    @Override
    public void exportExcel(HttpServletResponse response, @Valid RequestForm<EnStockEquipDefectVo> requestForm) {
        service.exportExcel(response, requestForm);
    }

    @Override
    public R<Boolean> auditDefects(AuditDefectsVo auditDefectsVo) {
        return R.ok(service.auditDefects(auditDefectsVo));
    }

    @Override
    public R<Page<EnStockEquipDefectVo>> pageByState(@Valid RequestForm<EnStockEquipDefectVo> requestForm) {
        return R.ok(service.pageByState(requestForm));
    }

    @Override
    public List<EnDefectsTjVo> getDefectsStatusXx(String sdate, String edate) {
        return service.getDefectsStatusXx(sdate, edate);
    }
}
